<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <script src="/js/jquery.min.js"></script>
    <script>

        $(function () {

            $("#btn").click(function () {
                $.get("/http/login", {id: 1}, function (data) {
                    console.log(data);
                })
            })


            $("#btn1").click(function () {
                $.get("/employees/22", function (data) {
                    console.log(data);
                })
            })

            $("#btn2").click(function () {
                $.get("/employees", function (data) {
                    console.log(data);
                })
            })

            $("#btn3").click(function () {
                $.post("/employees", {name: "dafei", age: 18}, function (data) {
                    console.log(data);
                })
            })

            $("#btn4").click(function () {
                $.ajax({
                    url: "/employees",
                    type: "DELETE",
                    data: {id: 1},
                    success:function (data) {
                        console.log(data);
                    }
                })
            })

            $("#btn5").click(function () {
                $.ajax({
                    url: "/employees",
                    type: "PUT",
                    data: {id: 1,name:"dafei",age:19},
                    success:function (data) {
                        console.log(data);
                    }
                })
            })

        })

    </script>
</head>

<body>
需求：使用js方式发起接口请求<br/>
<button id="btn">测试1</button>
<br/>
<button id="btn1">查单个</button>
<br/>
<button id="btn2">查多个</button>
<br/>
<button id="btn3">添加</button>
<br/>
<button id="btn4">删除</button>
<br/>
<button id="btn5">更新</button>
<br/>
</body>

</html>